<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <c:set var="ctx" value="${pageContext.request.contextPath }"></c:set>
		<meta charset="UTF-8">
		<title>华阳</title>
		<script src="<%=request.getContextPath()%>/resources/js/echarts.min.js"></script>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/bootstrap.css"/>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/bootstrap-theme.min.css"/>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/style.css"/>
		<script src="<%=request.getContextPath()%>/resources/js/jquery-1.7.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			*{
				margin:0;
				padding:0;
			}
			.contet-box .container{
	            width:95%;
	            margin:0 auto;
	            padding-top: 40px;
            }
            
            <!-- 
                BODY {background: url(<%=request.getContextPath()%>/resources/img/body-back.jpg) no-repeat;background-position: 0px 0px; background-attachment:fixed;}              
            --> 
		</style>
	</head>
	<body>
		<div class="header">
			<div class="header-content">
	            <div class="row clearfix">		          
		            <div class="logo">
		               <%--  <a href="${ctx }/back/zhuye"> --%>
		                	<img src="<%=request.getContextPath()%>/resources/img/raw_1514433813.png"/>
		            	<!-- </a> -->
		            </div>
		            <div class="tab-list">
		                <ul id="tablist">
                            <li class="tab1  tabin">
                            	<a href="${ctx }/department/showDept"><div class="tab-ico"></div></a>                            	
                            </li>
                            <li class="tab2">
                            	<a href="${ctx }/drivers/add_driver?pageNow=1"><div class="tab-ico"></div></a>  
                            </li>
                            <li class="tab6">
                            	<a href="${ctx }/accident/showAccident?pageNow=1"><div class="tab-ico"></div></a>  
                            </li>
                            <li class="tab4">
                            	<a href="${ctx }/after/showAfter?pageNow=1"><div class="tab-ico"></div></a>  
                            </li>
                            <li class="tab5">
                            	<a href="${ctx }/accountlist/selectAccountList"><div class="tab-ico"></div></a>  
                            </li>
                            <li class="tab3">
                            	<a href="${ctx }/back/guanli"><div class="tab-ico"></div></a>  
                            </li>
                            <div class="clearfix">
                            </div>
                        </ul>
		            </div>
		            <div class="top-user">
		            	<div class="user-ico">
		            		<img src="<%=request.getContextPath()%>/resources/img/raw_1514434504.jpg"/>
		            	</div>
		            	<div class="user-class">
		            		<p>${user.uname}</p>
		            		<p>${role.rolename}</p>
		            	</div>
		            	<div class="user-back">
		            		<a id=HyperLink3 onclick="logout()" href="javascript:window.opener=null;%20window.close();"><img src="<%=request.getContextPath()%>/resources/img/raw_1514434766.png"/></a>
		            	</div>
		            	<div class="clearfix"></div>
		            </div>
		            <div class="clearfix"></div>
	            </div>
            </div>
		</div>
		<div class="contet-box" id="contet-box">		
			<div class="content">
				<div class="container">
	                <div class="row clearfix">
		                
		                <div class="title text-center pull-left">
		                	<a href="#" class="btn btn-block" id="export" onclick="method5(val)">
			                	<span>导出表格</span>
		                	</a>
		                </div>
		               <div class="clearfix"></div>
		                <div class="col-md-12 column table-content table-responsive">
		                	<table class="table text-center" id="val" style="min-width: 2200px;overflow: scroll;">
		                		<thead>
		                			<tr class="table-bordered">
						                <th >
							                ID
						                </th>
						                <th>
							                                始发地
						                </th>
						                <th>
							                                目的地
						                </th>
						                <th>
							                                车型
						                </th>
						                <th>
							                                车架号
						                </th>
						                <th>
							                                驱数
						                </th>
						                <th>
							                                发车时间
						                </th>
						                <th>
							                                预计到达时间
						                </th>
						                <th>
							                              临牌到达时间
						                </th>
						                <th>
							                              保险到达时间
						                </th>
						                <th>
							                              运送驾驶员
						                </th>
						                <th>
							                             厂家结算
						                </th>
						                <th>
							                              驾驶员结算
						                </th>
						                <!-- <th>
							                              保险金额
						                </th> -->
						                <th>
							                              商业险金额
						                </th>
						                <th>
							                              强险金额
						                </th>
						                <th>
							                              临牌金额
						                </th>
						                <th>
							                              利润
						                </th>
						                <th>
							                              事故状态
						                </th>
						                <th>
							                              超时
						                </th>
						                <th>
							                              送达状态
						                </th>
						                <th>
							                              所属部门
						                </th>
						                <th>
							                              创建时间
						                </th>
						                <th>
							                              备注
						                </th>
						              <!--   <th>
							                              操作
						                </th> -->
					                </tr>
				                </thead>
				                <tbody>
				                <c:forEach var="wayVo" items="${wayVoList }">
					                <tr>
						                <td>
							                ${wayVo.wayid }
						                </td>
						                <td>
							                              ${wayVo.comCity }
						                </td>
						                <td>
							                               ${wayVo.bournCity }
						                </td>
						                <td>
							                              ${wayVo.vehicle }  
						                </td>
						                <td>
							                              ${wayVo.vin }
						                </td>
						                <td>
							                ${wayVo.actuate }
						                </td>
						                <td width="100">
							                <fmt:formatDate value="${wayVo.comDate }" pattern="yyyy-MM-dd     HH:mm"/>
						                </td>
						                <td width="100">
							                <fmt:formatDate value="${wayVo.yujiDate }" pattern="yyyy-MM-dd     HH:mm"/>
						                </td>
						                <td width="100">
							               <fmt:formatDate value="${wayVo.nearDate }" pattern="yyyy-MM-dd     HH:mm"/>
						                </td>
						                <td width="100">
							                <fmt:formatDate value="${wayVo.insuranceDate }" pattern="yyyy-MM-dd     HH:mm"/>
						                </td>
						                <td>
							              ${wayVo.transport }
						                </td>
						                <td>
							               ${wayVo.factoryMoney }
						                </td>
						                <td>
							                ${wayVo.pilotMoney }
						                </td>
						               <%--  <td>
							                ${wayVo.insuranceMoney }
						                </td> --%>
						                <td>
							                ${wayVo.commercialMoney }
						                </td>
						                <td>
							               ${wayVo.coerceMoney }
						                </td>
						                <td>
							                ${wayVo.amountMoney }
						                </td>
						                <td>
							                ${wayVo.profitMoney }
						                </td>
						                <td>
							                 ${wayVo.stateAcc }
						                </td>
						                <td>
							               ${wayVo.outTime }
						                </td>
						                <td>
							               ${wayVo.delivery }
						                </td>
						                <td>
							                ${wayVo.deptName }
						                </td>
						                <td width="100">
							               <fmt:formatDate value="${wayVo.creatDate }" pattern="yyyy-MM-dd     HH:mm"/>
						                </td>
						                <td width="100">
						                <div style="width:100px;height:60px;overflow-y:scroll;">
							               ${wayVo.remark }
							            </div>
						                </td>
					                </tr>
					               </c:forEach>
				                </tbody>
			                </table>
			                
			                
		                </div>	
		                <div class="col-md-12 column table-content table-responsive">
		                	<div class="col-md-4 column col-center-block text-center">
			                	<ul class="pagination">
		                            <li><a href="${ctx }/waybills/showWaybillAll?pageNow=1">首页</a></li>
		                            
		                            <li>
		                            	<c:if test="${pageAll.pageNow >1 && pageAll.pageNow < pageAll.totalPageCount+1 }">
		                            		<a href="${ctx }/waybills/showWaybill?pageNow=${pageAll.pageNow - 1}">上一页</a>
		                            	</c:if>
		                            </li>
		                            <li>
		                            	<c:if test="${pageAll.pageNow >=1 && pageAll.pageNow < pageAll.totalPageCount }">
		                            		<a href="${ctx }/waybills/showWaybillAll?pageNow=${pageAll.pageNow + 1}">下一页</a>
		                            	</c:if>
		                            </li>
		                            <li><a href="${ctx }/waybills/showWaybillAll?pageNow=${pageAll.totalPageCount}">末页</a></li>
		                            <li><a>共${pageAll.totalPageCount}页${pageAll.totalCount}条</a></li>
	                            </ul>
			                </div>
		                
		                </div>	                
		            </div>
		
                </div>
			</div>
			
		</div>
		<script src="<%=request.getContextPath()%>/resources/js/js.js" type="text/javascript" charset="utf-8"></script>
	</body>
	<script type="text/javascript">  
		//打印表格  
		var idTmr;  
		function getExplorer() {  
			var explorer = window.navigator.userAgent;  
			//ie    
			if (explorer.indexOf("MSIE") >= 0) {  
				return 'ie';  
			}  
			//firefox    
			else if (explorer.indexOf("Firefox") >= 0) {  
				return 'Firefox';  
			}  
			//Chrome    
			else if (explorer.indexOf("Chrome") >= 0) {  
				return 'Chrome';  
			}  
			//Opera    
			else if (explorer.indexOf("Opera") >= 0) {  
				return 'Opera';  
			}  
			//Safari    
			else if (explorer.indexOf("Safari") >= 0) {  
				return 'Safari';  
			}  
		}  
		function method5(tableid) {  
			if (getExplorer() == 'ie') {  
				var curTbl = document.getElementById(tableid);  
				var oXL = new ActiveXObject("Excel.Application");  
				var oWB = oXL.Workbooks.Add();  
				var xlsheet = oWB.Worksheets(1);  
				var sel = document.body.createTextRange();  
				sel.moveToElementText(curTbl);  
				sel.select();  
				sel.execCommand("Copy");  
				xlsheet.Paste();  
				oXL.Visible = true;  
			try {  
				var fname = oXL.Application.GetSaveAsFilename("Excel.xls",  
				"Excel Spreadsheets (*.xls), *.xls");  
			} catch (e) {  
				print("Nested catch caught " + e);  
			} finally {  
				oWB.SaveAs(fname);  
				oWB.Close(savechanges = false);  
				oXL.Quit();  
				oXL = null;  
				idTmr = window.setInterval("Cleanup();", 1);  
				}  
			  
				} else {  
					tableToExcel(tableid)  
				}  
			}  
			function Cleanup() {  
				window.clearInterval(idTmr);  
				CollectGarbage();  
			}  
			var tableToExcel = (function() {  
			var uri = 'data:application/vnd.ms-excel;base64,', template = '<html><head><meta charset="UTF-8"></head><body><table  border="1">{table}</table></body></html>', base64 = function(  
			s) {  
				return window.btoa(unescape(encodeURIComponent(s)))}, format = function(s, c) {  
				return s.replace(/{(\w+)}/g, function(m, p) {  
			return c[p];  
			})  
			}  
				return function(table, name) {  
				if (!table.nodeType)  
				table = document.getElementById(table)  
				var ctx = {  
				worksheet : name || 'Worksheet',  
				table : table.innerHTML  
			}  
				window.location.href = uri + base64(format(template, ctx))  
			}  
		})()  
	</script>  
	<script language="javascript" type="text/javascript">
		    function logout(){
			   if (confirm("您确定要退出系统吗？"))
			            top.location = "<%=request.getContextPath()%>/index.jsp";
			           
			         return false;
			         
			    }
		</script>
</html>
